﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Crank.Core
{
    static class TypeAliasPreprocessor
    {
        #region Blackboard Variables

        // Name, Type
        private static readonly IProperty<IDictionary<string, string>> TypeAliases = Blackboard.Create<IDictionary<string, string>>("TypeAliases");

        #endregion

        public static void Install()
        {
            Preprocessor.AddDirective("type", Process);
            TypeAliases.Value = new Dictionary<string, string>();            
        }

        public static void Process(string[] args)
        {
            if (args.Length != 2)
                throw new Exception("Invalid Type Alias");
            TypeAliases.Value.Add(args[0].ToLower(), args[1]);
        }

    }
}
